package iflyer.service;

import iflyer.dao.ProductCategoryRepository;
import iflyer.model.ProductCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author babylct
 * @Description //TODO
 * @Date 20:18 2018/7/20
 * @Param
 * @return
 **/
@Service
public class ProductCategoryService {

    @Autowired
    private ProductCategoryRepository productCategoryRepository;

    public ProductCategory findOne(Long categoryId) {

        return productCategoryRepository.getOne(categoryId);
    }

    public List<ProductCategory> findAll() {

        return productCategoryRepository.findAll();
    }

    public List<ProductCategory> findByCategoryTypeIn(List<String> categoryTypeList) {

        return productCategoryRepository.findByCategoryTypeIn(categoryTypeList);
    }

    public ProductCategory findByCategoryName(String categoryName) {

        return productCategoryRepository.findByCategoryNameEquals(categoryName);
    }

    public void save(ProductCategory productCategory) {

        productCategoryRepository.save(productCategory);
    }
}
